home *** CD-ROM | disk | FTP | other *** search
-
- #include <WindowMgr.h>
- #include <ListMgr.h>
- #include <OSUtil.h>
- #include <EventMgr.h>
-
- #include "MacCalc.h"
- #include "SheetHndlg.h"
- #include "CalcData.h"
-
- WindowPtr curr_window_ptr ;
-
- void DoMouseDown( ev )
- EventRecord *ev ;
- {
- SHEET_WIN_HDL sheet_record_hdl ;
- Point new_point ;
- int location ;
- GrafPtr tmp_port ;
- Rect boundsRect ;
- long newsize ;
- long menuchoice ;
- int width, heigth ;
- union {
- long tmp ;
- Cell last_cell ;
- } a ;
-
- location = FindWindow( ev->where, &curr_window_ptr ) ;
-
- if( ( curr_window_ptr != FrontWindow( ) ) && ( curr_window_ptr != NULL ) ) {
- SelectWindow( curr_window_ptr ) ;
- return ;
- }
-
- new_point = ev->where ;
- GetPort( &tmp_port ) ;
- SetPort( curr_window_ptr ) ;
- GlobalToLocal( &new_point ) ;
-
- switch( location ) {
- case inDesk:
- break ;
- case inMenuBar:
- menuchoice = MenuSelect( ev->where ) ;
- if( HiWord( menuchoice ) == FILE_MENU ) {
- quit_flag = TRUE ;
- }
- HiliteMenu( 0 ) ;
- break ;
- case inContent:
- sheet_record_hdl = (SHEET_WIN_HDL)GetWRefCon( curr_window_ptr ) ;
- if( LClick( new_point, ev->modifiers, (**sheet_record_hdl).sheet_list_hdl ) ) {
- a.tmp = LLastClick( (**sheet_record_hdl).sheet_list_hdl ) ;
- EnterData( a.last_cell, sheet_record_hdl ) ;
- }
- DrawGrid( curr_window_ptr ) ;
- break ;
- case inDrag:
- boundsRect = curr_screen ;
- DragWindow( curr_window_ptr, ev->where, &boundsRect ) ;
- break ;
- case inGrow:
- sheet_record_hdl = (SHEET_WIN_HDL)GetWRefCon( curr_window_ptr ) ;
- newsize = GrowWindow( curr_window_ptr, ev->where, &minmax_size ) ;
- if( newsize ) {
- width = ( ( LoWord( newsize ) / CELL_WIDTH ) * CELL_WIDTH ) + 15 ;
- heigth = ( ( HiWord( newsize ) / CELL_HEIGTH ) * CELL_HEIGTH ) + 15 ;
- SizeWindow( curr_window_ptr, width, heigth, TRUE ) ;
- LSize( width-15, heigth-15, (**sheet_record_hdl).sheet_list_hdl ) ;
- DrawGrid( curr_window_ptr ) ;
- DrawGrowIcon( curr_window_ptr ) ;
- }
- break ;
- case inGoAway:
- if( TrackGoAway( curr_window_ptr, ev->where ) ) {
- quit_flag = TRUE ;
- }
- break ;
- }
- SetPort( tmp_port ) ;
-
- return ;
- }
- int ClikLoop( )
- {
- DrawGrid( curr_window_ptr ) ;
- return TRUE ;
- }